package com.zhongke.cotrun.model.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhongke.cotrun.model.validator.UserValidator;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.Date;

@Data
public class ServiceRelease {
    @NotNull(message = "id号不能为空", groups = {UserValidator.UpDate.class})
    private Integer serviceReleaseId;//服务id号
    @NotNull(message = "关联账号的id号不能为空", groups = {UserValidator.InSet.class})
    private Integer linkUserId;//关联的账号id
    @NotBlank(message = "服务名称不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    private String serviceName; //服务名称
    @NotNull(message = "服务类别不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    private Integer serciceType;//服务类别按类别分开

    private String region;//地区 多个地区用，分割
    private Integer isnationwide;//1是 0否  全国

    private BigDecimal price;//价格
    private Integer negotiable;//是否面议 1是 0否

    @NotBlank(message = "联系人不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    private String linkman;//联系人
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号码格式错误", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    @NotBlank(message = "联系电话不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    private String phonenumber;//联系电话
    @NotBlank(message = "宣传图不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    private String advertisingMap;//宣传图
    @NotBlank(message = "服务详情不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    @Size(message = "字符在3000字以内", max = 10000, min = 1)
    private String serviceDetails;//服务详情
    @NotBlank(message = "关键字不能为空", groups = {UserValidator.InSet.class, UserValidator.UpDate.class})
    private String keyWord;//关键字多个用，分割
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;//创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;//跟新时间
    private Integer statue;//服务状态 0正常 1暂停 2删除
    private String sort;//排序
    private Integer recommend;//是否为推荐0否1是
    private UserInforCompany userInforCompany;//关联的用户信息
}
